<%@ page language="java" import="java.util.*,code.bean.*,code.util.*"
	pageEncoding="UTF-8"%>
<%@ page import="code.util.PageObject"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setCharacterEncoding("UTF-8");
	String userid = ParamUtils.getParameter(request, "userid", "");
	String title = ParamUtils.getAttribute(request, "title", "");
	String lang = ParamUtils.getAttribute(request, "lang", "");
	String category = ParamUtils.getAttribute(request, "category", "");
%>

<%
	PageObject pageObject = (PageObject) ParamUtils.getObjectAttribute(
			request, "page", null);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>CodeSharer-搜索结果</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

		<link href="css/s.css" rel="stylesheet" type="text/css" />
        <link href="css/comment_7.css" rel="stylesheet" type="text/css" />
		<SCRIPT language="javascript" src="js/code.js"></SCRIPT>

	</head>

 <body>
   <div id="head">
	<div class="hd">
		<div class="l tac wl2" style="width:720px;padding:3px;">
		<table width="100%"><tr>
			<td><div style="padding-left:15px;"><a href="servlet/ShowIndex1"><img src="images/pcslogo.gif"/></a></div></td>
			<td class="ce" style="font-size:14px">
			&nbsp;<a href="servlet/ShowSpace?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" class="ce">主页</a>&nbsp;┊
			&nbsp;<a href="servlet/ShowCode?userid=<%=ParamUtils.getParameter(request, "userid", "")%>&blogdate=<%=DateUtils.format(Calendar.getInstance().getTime())%>" class="ce">我的代码</a>&nbsp;┊
			&nbsp;<a href="servlet/ShowShare?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" class="ce">我的收藏</a>&nbsp;┊
			&nbsp;<a href="servlet/ShowProfile?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" class="ce">用户信息</a>&nbsp;┊
			&nbsp;<a href="servlet/ManageCode?userid=<%=ParamUtils.getParameter(request, "userid", "")%>&cmd=add" class="ce">发布代码</a>&nbsp;┊
			&nbsp;<a href="../CodeSharer/advSearch.jsp?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" class="ce">搜索</a>
			
			<%
				if(session.getAttribute("loginUser") != null && ((User)(session.getAttribute("loginUser"))).getId().equals(ParamUtils.getParameter(request, "userid", "")))
			    { 
					out.println("&nbsp;┊&nbsp;<a href=\"servlet/CodeList?userid=" + ParamUtils.getParameter(request, "userid", "") + "\" class=\"ce"+"\">代码管理</a>");
				    out.println("&nbsp;┊&nbsp;<a href=\"servlet/ShareList?userid=" + ParamUtils.getParameter(request, "userid", "") + "\" class=\"ce"+"\">收藏管理</a>");
				    out.println("&nbsp;┊&nbsp;<a href=\"servlet/DoLogout" + "\" class=\"ce"+"\">退出</a>");
				}
			%>
			</td>
		</tr></table>
		</div>
		<div align="right">
			<table>
			<tr>
			<td>
			    <div style="padding:4px;"></div>
				<form name="" action="servlet/SearchCodeByTitle?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" method="post">
				<input type="text" name = "title1" value="" maxlength="15"/>
				<input type="submit" class="signinbtn1" value="搜标题"/>
				</form>
			</td>
			<td>
			&nbsp;&nbsp;&nbsp;&nbsp;
			<%if(session.getAttribute("loginUser") != null){ %>
			<a href="servlet/ShowSpace?userid=<%=
			((User)
			(session.getAttribute
			("loginUser"))).getId()
			%>" class="ce" style="font-size:16px">
			<%=((User)
			(session.getAttribute
			("loginUser"))).getNickName()%>
			</a>
			<%}%>
			</td>
			</tr>
			</table>
		</div>
		<div class="c"></div>
	</div>
</div>
<!--Head End-->

<div id="main">
	<div class="m1 wl2" style="width:230px;">
    	<div class="m1t"></div>
       <div style="padding:15px 0 0 15px;">
		
		    <div class="f13 ml20"><span style="font:bold 20px '黑体'; color:#D01E3B;">CodeSharer<br /></span> </div>
		    <div style="background:url(images/index_app.gif) repeat-x;width:190px;margin:20px auto 15px 7px;height:2px;"></div>

            <div id="text1div" class="f13 ml20"><img src="images/arrow_l.gif" align="absmiddle" />这里是帮助你管理你的代码，并与你的朋友、同事、同学一起分享代码的真实平台</div>
	     
			<div style="background:url(images/index_app.gif) repeat-x;width:190px;margin:20px auto 15px 7px;height:2px;"></div>
						
			<div id="text1div" class="f13 ml20"><img src="images/arrow_l.gif" align="absmiddle" />支持代码高亮显示</div>
			<div style="padding:2px;"></div>
			<div id="text1div" class="f13 ml20"><img src="images/arrow_l.gif" align="absmiddle" />支持代码版本控制</div>
			<div style="padding:2px;"></div>
			<div id="text1div" class="f13 ml20"><img src="images/arrow_l.gif" align="absmiddle" />支持代码分享、收藏、评论</div>
			<div style="padding:2px;"></div>
		</div>
    </div>
	
	<div class="m2 wr2" style="width:770px;">
	   <div id="r2s_2">
		<div style="padding:3px;"></div>
	   
		
	   
		<form action="servlet/ManageCode?userid=<%=ParamUtils.getParameter(request, "userid", "")%>" method="post">
			<input type="hidden" name="cmd">
			<input type="hidden" name="id">
			
			<div style="padding:10px;"></div>
		 
		  <table width="90%" align="center">
				<tr>
					<td height="19" align="center">
						<%
							if (pageObject.getTotal() == 0) {
								out.println("没有匹配的项目");
							} else
								out.println("共有 " + pageObject.getTotal() + " 条匹配的项目");
						%>
					</td>
				</tr>
			</table>
		  <div style="padding:10px;"></div>
		
	      <table width="90%"  border="0" cellspacing="0" align="center">
	        <tr align="center">
	          <td width="25%">标题</td>
	          <td width="5%">语言</td>
	          <td width="15%">标签</td>
	          <td width="30%">创建日期</td>
	          <td width="15%">操作</td>
	        </tr>
	        <%
	        	int i = 0;
	        	for(;i < pageObject.getList().size(); i++){
	         			Code code = (Code)pageObject.getList().get(i);
	        %>
	        <tr align="center">
	          	<td><%=code.getTitle()%></td>
	          	<td><%=code.getLanguage()%></td>
	        	<td><%=code.getCategory().getCategoryName()%></td>
	        	<td><%=code.getPublishTime().substring(0,code.getPublishTime().length()-2)%></td>
	        	<td>
	        		<INPUT type="submit" name="viewButton" value="查看" class="inputbtn" onClick="doSubmit('view','<%=code.getId()%>')">
	        	</td>
	        </tr>
			
	        <%
	        	}
	        	for(;i < pageObject.getPageSize(); i++){
	        %>
	        <tr align="center">
	          	<td>&nbsp;</td>
	        	<td>&nbsp;</td>
	        	<td>&nbsp;</td>
	        	<td>&nbsp;</td>
	        	
	        </tr>
	        <%
	        	}
	        %>
	      </table>
		 
	      </form>
	      <form name="myform1" action="servlet/SearchCode?userid=<%=userid%>&title=<%=title%>&lang=<%=lang%>&category=<%=category%>" method="post">
	      <table width="100%">
	      	<tr width="100%">
	      		<td width="100%" align="center" style="font-size: 14px">
	          		<script language="javascript">document.write(getPageInfo(<%=pageObject.getTotal()%>,<%=pageObject.getPageSize()%>,<%=pageObject.getPageNo()%>,5,'images/page_img','myform1'));</script>
		        </td>
	        </tr>
			<div style="padding:3px;"></div>
	      </table>
      	</form>
		<div style="padding:10px;"></div>
	   
	   </div>
	</div>
</div>

<div id="b">
	<div class="b1"><a href="#" class="c6" target="_blank">关于我们</a><span>┊</span><a href="/s/contact.html" class="c6" target="_blank">联系方式</a><span>┊</span><a href="/t/feedback.html" class="c6" target="_blank">意见反馈</a><span>┊</span><a href="/s/help.html" class="c6" target="_blank">帮助中心</a>　 &nbsp;<a class=c6 href=http://www.miibeian.gov.cn target=_blank>NENU</a> <img src="images/gs.gif" width="15" align="absmiddle" />&nbsp;<img src="images/jc.gif" width="17" align="absmiddle" /></div>

</div>


</body>
</html>